

<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
  <meta charset="utf-8">
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  
  <title>Appendix: Writing Your Own Plugins &mdash; SSLyze 2.1.0 documentation</title>
  

  
  
  
  

  
  <script type="text/javascript" src="_static/js/modernizr.min.js"></script>
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
        <script type="text/javascript" src="_static/jquery.js"></script>
        <script type="text/javascript" src="_static/underscore.js"></script>
        <script type="text/javascript" src="_static/doctools.js"></script>
        <script type="text/javascript" src="_static/language_data.js"></script>
    
    <script type="text/javascript" src="_static/js/theme.js"></script>

    

  
  <link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
  <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="prev" title="Appendix: Available Scan Commands" href="available-scan-commands.html" /> 
</head>

<body class="wy-body-for-nav">

   
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search" >
          

          
            <a href="index.html" class="icon icon-home"> SSLyze
          

          
          </a>

          
            
            
              <div class="version">
                2.1.0
              </div>
            
          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <ul>
<li class="toctree-l1"><a class="reference internal" href="testing-connectivity.html">Step 1: Testing Connectivity to a Server</a></li>
<li class="toctree-l1"><a class="reference internal" href="running-scan-commands.html">Step 2: Running Scan Commands Against a Server</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="available-scan-commands.html">Appendix: Available Scan Commands</a></li>
</ul>
<ul class="current">
<li class="toctree-l1 current"><a class="current reference internal" href="#">Appendix: Writing Your Own Plugins</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#high-level-overview">High Level Overview</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#module-sslyze.plugins.plugin_base">Core parent classes</a></li>
</ul>
</li>
</ul>
</li>
</ul>

            
          
        </div>
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="index.html">SSLyze</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="index.html">Docs</a> &raquo;</li>
        
      <li>Appendix: Writing Your Own Plugins</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
            
            <a href="_sources/writing-a-plugin.rst.txt" rel="nofollow"> View page source</a>
          
        
      </li>
    
  </ul>

  
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
  <div class="section" id="appendix-writing-your-own-plugins">
<h1>Appendix: Writing Your Own Plugins<a class="headerlink" href="#appendix-writing-your-own-plugins" title="Permalink to this headline">¶</a></h1>
<p>Things that SSLyze can scan for are implemented using a plugin system. If you want to create a new plugin, the easiest
way to get started is to review a simple existing plugin such as the <cite>CompressionPlugin</cite> in
<cite>sslyze.plugins.compression_plugin</cite>.</p>
<div class="section" id="high-level-overview">
<h2>High Level Overview<a class="headerlink" href="#high-level-overview" title="Permalink to this headline">¶</a></h2>
<p>A plugin is made of one <cite>Plugin</cite> subclass and one or multiple subclasses of <cite>PluginScanCommand</cite> and <cite>PluginScanResult</cite>.
The <cite>Plugin</cite> receives a <cite>PluginScanCommand</cite>, performs the corresponding scan, and returns a <cite>PluginScanResult</cite>.</p>
<p>For the <cite>Plugin</cite> to be discovered by SSLyze, it needs to be added to <cite>sslyze.plugins.plugin_repository</cite>.</p>
<div class="section" id="module-sslyze.plugins.plugin_base">
<span id="core-parent-classes"></span><h3>Core parent classes<a class="headerlink" href="#module-sslyze.plugins.plugin_base" title="Permalink to this headline">¶</a></h3>
<dl class="class">
<dt id="sslyze.plugins.plugin_base.Plugin">
<em class="property">class </em><code class="sig-prename descclassname">sslyze.plugins.plugin_base.</code><code class="sig-name descname">Plugin</code><a class="headerlink" href="#sslyze.plugins.plugin_base.Plugin" title="Permalink to this definition">¶</a></dt>
<dd><p>Abstract class to represent one plugin which can implement one multiple PluginScanCommand and PluginScanResult.</p>
<dl class="method">
<dt id="sslyze.plugins.plugin_base.Plugin.process_task">
<em class="property">abstract </em><code class="sig-name descname">process_task</code><span class="sig-paren">(</span><em class="sig-param">server_info</em>, <em class="sig-param">scan_command</em><span class="sig-paren">)</span><a class="headerlink" href="#sslyze.plugins.plugin_base.Plugin.process_task" title="Permalink to this definition">¶</a></dt>
<dd><p>Should run the supplied scan command on the server and return the result.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>server_info</strong> (<a class="reference internal" href="testing-connectivity.html#sslyze.server_connectivity_info.ServerConnectivityInfo" title="sslyze.server_connectivity_info.ServerConnectivityInfo"><code class="xref py py-class docutils literal notranslate"><span class="pre">ServerConnectivityInfo</span></code></a>) – The server to run the scan command on.</p></li>
<li><p><strong>scan_command</strong> (<a class="reference internal" href="#sslyze.plugins.plugin_base.PluginScanCommand" title="sslyze.plugins.plugin_base.PluginScanCommand"><code class="xref py py-class docutils literal notranslate"><span class="pre">PluginScanCommand</span></code></a>) – The scan command.</p></li>
</ul>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><a class="reference internal" href="available-scan-commands.html#sslyze.plugins.plugin_base.PluginScanResult" title="sslyze.plugins.plugin_base.PluginScanResult"><code class="xref py py-class docutils literal notranslate"><span class="pre">PluginScanResult</span></code></a></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>The result of the scan command run on the supplied server.</p>
</dd>
</dl>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="sslyze.plugins.plugin_base.PluginScanCommand">
<em class="property">class </em><code class="sig-prename descclassname">sslyze.plugins.plugin_base.</code><code class="sig-name descname">PluginScanCommand</code><a class="headerlink" href="#sslyze.plugins.plugin_base.PluginScanCommand" title="Permalink to this definition">¶</a></dt>
<dd><p>Abstract class to represent one specific thing a Plugin can scan for.</p>
<dl class="method">
<dt id="sslyze.plugins.plugin_base.PluginScanCommand.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#sslyze.plugins.plugin_base.PluginScanCommand.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p>Optional arguments for a command can be passed as keyword arguments here.</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">None</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt id="sslyze.plugins.plugin_base.PluginScanCommand.get_cli_argument">
<em class="property">abstract classmethod </em><code class="sig-name descname">get_cli_argument</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#sslyze.plugins.plugin_base.PluginScanCommand.get_cli_argument" title="Permalink to this definition">¶</a></dt>
<dd><p>Should return the command line option to be used to run the scan command via the CLI.</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt id="sslyze.plugins.plugin_base.PluginScanCommand.is_aggressive">
<em class="property">classmethod </em><code class="sig-name descname">is_aggressive</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#sslyze.plugins.plugin_base.PluginScanCommand.is_aggressive" title="Permalink to this definition">¶</a></dt>
<dd><p>Should return True if command will open many simultaneous connections to the server.</p>
<p>When using the ConcurrentScanner to run scan commands, only one aggressive command will be run concurrently per
server, to avoid DOS-ing the server.</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></p>
</dd>
</dl>
</dd></dl>

</dd></dl>

<dl class="class">
<dt>
<em class="property">class </em><code class="sig-prename descclassname">sslyze.plugins.plugin_base.</code><code class="sig-name descname">PluginScanResult</code><span class="sig-paren">(</span><em class="sig-param">server_info</em>, <em class="sig-param">scan_command</em><span class="sig-paren">)</span></dt>
<dd><p>Abstract class to represent the result of running a specific PluginScanCommand against a server .</p>
<dl class="attribute">
<dt id="sslyze.plugins.plugin_base.PluginScanResult.server_info">
<code class="sig-name descname">server_info</code><a class="headerlink" href="#sslyze.plugins.plugin_base.PluginScanResult.server_info" title="Permalink to this definition">¶</a></dt>
<dd><p>The server against which the command was run.</p>
<dl class="field-list simple">
<dt class="field-odd">Type</dt>
<dd class="field-odd"><p><a class="reference internal" href="testing-connectivity.html#sslyze.server_connectivity_info.ServerConnectivityInfo" title="sslyze.server_connectivity_info.ServerConnectivityInfo">ServerConnectivityInfo</a></p>
</dd>
</dl>
</dd></dl>

<dl class="attribute">
<dt id="sslyze.plugins.plugin_base.PluginScanResult.scan_command">
<code class="sig-name descname">scan_command</code><a class="headerlink" href="#sslyze.plugins.plugin_base.PluginScanResult.scan_command" title="Permalink to this definition">¶</a></dt>
<dd><p>The scan command that was run against the server.</p>
<dl class="field-list simple">
<dt class="field-odd">Type</dt>
<dd class="field-odd"><p><a class="reference internal" href="#sslyze.plugins.plugin_base.PluginScanCommand" title="sslyze.plugins.plugin_base.PluginScanCommand">PluginScanCommand</a></p>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt>
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">server_info</em>, <em class="sig-param">scan_command</em><span class="sig-paren">)</span></dt>
<dd><p>Initialize self.  See help(type(self)) for accurate signature.</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">None</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt>
<em class="property">abstract </em><code class="sig-name descname">as_xml</code><span class="sig-paren">(</span><span class="sig-paren">)</span></dt>
<dd><p>Should return the XML output to be returned by the CLI tool when –xml_out is used.</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">Element</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt>
<em class="property">abstract </em><code class="sig-name descname">as_text</code><span class="sig-paren">(</span><span class="sig-paren">)</span></dt>
<dd><p>Should return the text output to be displayed in the console by the CLI tool.</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">List</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>]</p>
</dd>
</dl>
</dd></dl>

</dd></dl>

</div>
</div>
</div>


           </div>
           
          </div>
          <footer>
  
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
      
      
        <a href="available-scan-commands.html" class="btn btn-neutral float-left" title="Appendix: Available Scan Commands" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
      
    </div>
  

  <hr/>

  <div role="contentinfo">
    <p>
        &copy; Copyright 2019, SSLyze

    </p>
  </div>
  Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>. 

</footer>

        </div>
      </div>

    </section>

  </div>
  


  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>